package com.matt.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.matt.foundation.retention.FieldMeta;
import com.matt.foundation.model.Domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * *******************************
 * description:线索
 * Created by Ron.
 * form com.matt
 * on 2018/6/12
 * *******************************
 */
@Data
@Table(name = "leads")
@Entity
@EqualsAndHashCode(callSuper = true)
public class Leads extends Domain{
    @ApiModelProperty("身份证号")
    @FieldMeta(name = "身份证号")
    @Column(columnDefinition = "varchar(50) COMMENT '身份证号'")
    private String idCard;

    @Column(columnDefinition = "varchar(50) COMMENT '线索来源id'")
    private String channelId;
    @Transient
    private List<LeadsUser> list;
    @Transient
    List<String> leadsId;
 @Transient
 private String age;

   @Column(columnDefinition = "int default 0 COMMENT '状态'")
   private Integer typeStatus;

    @FieldMeta(name="线索来源")
    @Column(columnDefinition = "varchar(50) COMMENT '线索来源'")
    private String channel;

    @FieldMeta(name = "介绍人")
    @Column(columnDefinition = "varchar(30) COMMENT '介绍人'")
    private String fromUser;

    @Column(columnDefinition = "varchar(32) COMMENT '介绍人id=客户id'")
    private String fromUserId;

    @FieldMeta(name = "线索方式")
    @Column(columnDefinition = "int default 1 COMMENT '线索方式 1：主动， 2：被动'")
    private Integer category=1;

    @FieldMeta(name = "线索状态")
    @Column(columnDefinition = "int default 1 COMMENT ' 状态  1:未处理  2：初访->(沟通中) 3：已邀约 4：已到访  5：不敢兴趣  6：未接通  7：地域不符 8：孩子超龄 9：无效的联系方式'")
    private Integer status;

    @Column(columnDefinition = "int(10) DEFAULT '0' COMMENT '0 = 新线索 1 = 跟进中 2 = 已缴订金 3 = 已转化 4 = 已放弃 5投入公海'")
    private String zhwysStatus;

    @Column(columnDefinition = "int default 0 COMMENT '级别 0 =A重点客户 1=B普通客户 2=C非优先客户,3=D意愿不强'")
    private Integer rankp;

    @Column(columnDefinition = "int default 1 COMMENT '线索线索来源渠道 1：电话联系  2：到店来访  3：网络联系  4：转介绍 5：地推  6：异地合作 7:市场活动  8：系统导入'")
//    @Column(columnDefinition = "int default 1 COMMENT '客户来源 1：美团  2：转介绍  3：大众点评  4：抖音'")
    private Integer channStatus;

    @Column(columnDefinition = "int default 1 COMMENT '客户来源 1：美团  2：转介绍  3：大众点评  4：抖音 '")
    private Integer channelStatus;

    @Column(columnDefinition = "int default 0 COMMENT ' 客户状态  1:新分配  2：首访 3：上门 4：试听  5：试托  6：签单  7：续费 8：无效 '")
    private Integer clientStatus;

    @Column(columnDefinition = "int default 0 COMMENT '是否转为客户  0:未转  1:已转 '")
    private Integer changeStatus=0;

    @Column(columnDefinition = "varchar(50) COMMENT '是否转为客户   已转  ：未转'")
    private String changeStatusVal;

    @Column(columnDefinition = "varchar(50) COMMENT '是否完整'")
    private String isComplete;

    @FieldMeta(name = "宝宝大名")
    @Column(columnDefinition = "varchar(50) COMMENT '宝宝大名'")
    private String childName;

    @FieldMeta(name = "孩子生日")
    @Column(columnDefinition = "datetime COMMENT '孩子生日'")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date birthday;

    @FieldMeta(name = "投入公海时间")
    @Column(columnDefinition = "datetime COMMENT '投入公海时间'")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date  seasTime;

    @FieldMeta(name = "宝宝乳名")
    @Column(columnDefinition = "varchar(50) COMMENT '宝宝乳名'")
    private String nickName;

    @FieldMeta(name = "英文名称")
    @Column(columnDefinition = "varchar(50) COMMENT '英文名称'")
    private String englishName;

    @FieldMeta(name = "性别")
    @Column(columnDefinition = "int default 0 COMMENT '性别 1:男   0：女' 2：未知")
    private Integer gender;

    @FieldMeta(name = "血型")
    @Column(columnDefinition = "varchar(50) COMMENT '血型'")
    private String  bloodType;

    @FieldMeta(name = "国籍")
    @Column(columnDefinition = "varchar(50) COMMENT '国籍'")
    private String nationality;

    @FieldMeta(name = "目标幼儿园")
    @Column(columnDefinition = "varchar(100) COMMENT '目标幼儿园'")
    private String targetGarden;

    @FieldMeta(name = "户籍所在地")
    @Column(columnDefinition = "varchar(255) COMMENT '户籍所在地'")
    private String registerResidence;

    @FieldMeta(name = "户籍类型")
    @Column(columnDefinition = "varchar(50) COMMENT '户籍类型    1：本片  2：本区外片 3：本市外区  4：外籍  5：港澳台'")
    private String registerType;

    @FieldMeta(name = "所处语言环境")
    @Column(columnDefinition = "varchar(50) COMMENT '所处语言环境'")
    private String languageEnvironment;

    @FieldMeta(name = "姓名")
    @Column(columnDefinition = "varchar(50) COMMENT '姓名'")
    private String name;

    @FieldMeta(name = "关系")
    @Column(columnDefinition = "varchar(50) COMMENT '关系'")
    private String relationship;

    @FieldMeta(name = "联系电话")
    @Column(columnDefinition = "varchar(20) COMMENT '联系电话'")
    private String mobile;

    @FieldMeta(name = "家庭住址")
    @Column(columnDefinition = "varchar(100) COMMENT '家庭住址'")
    private String homeAddress;

    @FieldMeta(name = "工作单位")
    @Column(columnDefinition = "varchar(50) COMMENT '工作单位'")
    private String company;

    @FieldMeta(name = "职务")
    @Column(columnDefinition = "varchar(50) COMMENT '职务'")
    private String duty;

    @FieldMeta(name = "学历")
    @Column(columnDefinition = "varchar(50) COMMENT '学历'")
    private String degree;

    @Column(columnDefinition = "varchar(32) COMMENT '线索所属'")
    private String staffId;

    @Column(columnDefinition = "varchar(50) COMMENT '员工姓名'")
    private String staffName;

    @Column(columnDefinition = " datetime DEFAULT NOW() COMMENT '最后更新时间' ")
    private Date lastModified;

    @Column(columnDefinition = "varchar(32) COMMENT '最后更新人'")
    private String lastModifiedId;

    @Column(columnDefinition = "varchar(32) COMMENT '所属园区'")
    private String areaId;

    @Column(columnDefinition = "datetime COMMENT '上次跟进时间' ")
    private Date lastFollowTime;

    @Column(columnDefinition = "datetime COMMENT '下次跟进时间' ")
    private Date nextTime;

    //最新跟进记录  获取跟进记录中最新的内容
    @Column(columnDefinition = "longtext COMMENT '最近跟进记录'")
    private String lastFollowRecord;

    @Column(columnDefinition = "varchar(255) COMMENT '详细地址'")
    private String address;

    @Column(columnDefinition = "varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '备注'")
    private String remark;

    @Column(columnDefinition = "COLLATE utf8mb4_bin DEFAULT NULL COMMENT '头像'")
    private String avatar;


    @Column(columnDefinition = "COLLATE utf8mb4_bin DEFAULT NULL COMMENT '月龄'")
    private String monthsDiff;

    @Column(columnDefinition = "varchar(32) COMMENT '省份'")
    private String province;

    @Column(columnDefinition = "varchar(32) COMMENT '市'")
    private String city;

    @Column(columnDefinition = "varchar(32) COMMENT '区'")
    private String area;

    @Column(columnDefinition = "VARCHAR(255) COMMENT '续费人id'")
    private String userId;
    @Column(columnDefinition = "VARCHAR(255) COMMENT '续费人名称'")
    private String userName;

    @Column( columnDefinition = "INT COMMENT '续费方式（1.微信支付，2.支付宝，3.银行卡，4.现金，5.其他）'")
    private Integer renewalMethod;

    @Column( columnDefinition = "VARCHAR(255)  NULL COMMENT '宝宝大名'")
    private String childBigName;


    @Column(columnDefinition = "VARCHAR(255) COMMENT '宝宝乳名'")
    private String childNickName;

    @Column( columnDefinition = "INT COMMENT '宝宝年龄'")
    private Integer childAge;
    @Column( columnDefinition = "decimal(12, 2) COMMENT '缴纳定金'")
    private BigDecimal  penny=BigDecimal.ZERO;
}
